<template>
	<view class="setup">
		<!-- <view class="ygregister_bos">
			<view class="ygregister_title">挂号状态</view>
			<view class="ygregister_box">
				<switch color="#6ccbb6" style="transform: scale(.8,.8)" :checked="doctorobj.hang_number_status == 1" @change="Onstatus" />
			</view>
		</view> -->
		<view class="ygregister_bos">
			<view class="ygregister_title">图文问诊</view>
			<view class="ygregister_box">
				<switch color="#6ccbb6" style="transform: scale(.8,.8)" :checked="doctorobj.consultation_status == 1" @change="Onimgtext" />
			</view>
		</view>
		<view class="ygregister_bos">
			<view class="ygregister_title">视频问诊</view>
			<view class="ygregister_box">
				<switch color="#6ccbb6" style="transform: scale(.8,.8)" :checked="doctorobj.consultation_viedo_status == 1" @change="Onvideo" />
			</view>
		</view>
		<view class="ygregister_bos">
			<view class="ygregister_title">报告解读</view>
			<view class="ygregister_box">
				<switch color="#6ccbb6" style="transform: scale(.8,.8)" :checked="doctorobj.consultation_report_status == 1" @change="Onreport" />
			</view>
		</view>
		<!-- <view class="textarea_bos">患者欢迎词</view> -->
		<!-- <textarea class="textarea_ygregister" placeholder="患者进入聊天页面,自动发送得第一句话" @input="Ongoodat" placeholder-class="placeholderClass" /> -->
		<!-- 确定 -->
		<view class="qx_button">
			<view @click="Onsubmit" class="font-323232 font16">确定</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//详情
				doctorobj: {
					hang_number_status: 1,
					consultation_status: 1,
					consultation_viedo_status: 1,
					consultation_report_status: 1
				},
			}
		},
		onLoad() {
			//详情
			this.Ondoctor()
		},
		methods: {
			//详情
			Ondoctor() {
				this.$Http({
					url: 'getUserInfo',
					data: {},
					type:'POST',
				}).then(res => {
					if (res.code == 1) {
						this.doctorobj.hang_number_status = res.data.doctor_info.hang_number_status
						this.doctorobj.consultation_status = res.data.doctor_info.consultation_status
						this.doctorobj.consultation_viedo_status = res.data.doctor_info.consultation_viedo_status
						this.doctorobj.consultation_report_status = res.data.doctor_info.consultation_report_status
						console.log(this.doctorobj, '奇怪~')
					}
				});
			},
			//工作状态
			Onstatus(e) {
				this.doctorobj.hang_number_status = e.detail.value ? 1 : 0
			},
			//图文问诊
			Onimgtext(e) {
				this.doctorobj.consultation_status = e.detail.value ? 1 : 0
			},
			//视频问诊
			Onvideo(e) {
				this.doctorobj.consultation_viedo_status = e.detail.value ? 1 : 0
			},
			//视频问诊
			Onreport(e) {
				this.doctorobj.consultation_report_status = e.detail.value ? 1 : 0
			},
			//提交
			Onsubmit() {
				this.$Http({
					url: 'editDoctorService',
					data: this.doctorobj,
					show: true,
				}).then(res => {
					if (res.code == 1) {
						uni.showModal({
							title: '操作提示',
							confirmText: '确定',
							confirmColor: '#b8875c',
							content: '提交成功',
							showCancel: false,
							success: function(res) {
								if (res.confirm) {
									uni.switchTab({
										url: '/pages/doctor/my',
									})
								}
							}
						});
					}
				});
			}
		}
	}
</script>

<style>
	.setup {
		padding-top: 30rpx;
	}

	/* 姓名 */
	.ygregister_bos {
		width: 680rpx;
		margin-left: 35rpx;
		display: flex;
		border-bottom: 1rpx solid #f5f5f5;
		display: flex;
		align-items: center;
		padding: 20rpx 0;
	}

	/* 标题 */
	.ygregister_title {
		width: 160rpx;
		display: flex;
		align-items: center;
		font-size: 30rpx;
		color: #323232;
		font-weight: 700;
	}

	/* 中间 */
	.ygregister_box {
		width: 476rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.placeholderClass {
		color: #c8c8c8;
		font-size: 30rpx;
		line-height: 100rpx;
	}

	.input_ygregister {
		width: 476rpx;
		height: 100rpx;
		line-height: 100rpx;
		color: #323232;
	}

	/* 富文本 */
	.textarea_bos {
		width: 680rpx;
		margin-left: 35rpx;
		font-size: 30rpx;
		color: #323232;
		font-weight: 700;
		padding: 20rpx 0;
	}

	.textarea_ygregister {
		width: 680rpx;
		margin-left: 35rpx;
		line-height: 50rpx;
		color: #323232;
		height: 320rpx;
		background-color: #f9f9f9;
		border-radius: 5rpx;
		padding: 30rpx 26rpx;
	}

	/* 提交 */
	.qx_button {
		width: 750rpx;
		height: 120rpx;
		position: fixed;
		bottom: 0;
		left: 0;
		background-color: #f9f9f9;
		z-index: 333;
	}

	.qx_button view {
		width: 650rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		margin-left: 50rpx;
		margin-top: 20rpx;
		background-color: #6bcbb6;
		color: #fff;
	}
</style>
